#include <8052.h>

#define COUNT (65536 - (int)(11030000.0 / 12 / 1000 + 0.5))

void timer_init(void)
{
    TMOD = TMOD & 0xf0 | 0b00000001;
    TL0 = COUNT;
    TH0 = COUNT >> 8;
    ET0 = 1;
    EA = 1;
    TR0 = 1;
}

void timer_reset(void)
{
    TL0 = COUNT;
    TH0 = COUNT >> 8;
}
